//滚动效果，元素，子元素高度，滚动频率（毫秒）
export function gundong(node, childHeight, time) {
	var copy = node.clone(true);
	node.parent().append(copy);
	var height = node.height();
	var tag = 1;	//1.node, 2.copy
	var nodetop = 0;
	var copytop = childHeight-height;
	node.css({'top':`${nodetop}px`, 'position':'relative'});
	copy.css({'top':`${copytop}px`, 'position':'relative'});

	//return;
	setInterval(()=>{
		if (tag == 1 && Math.abs(nodetop) >= height-childHeight) {
			nodetop-=childHeight;
			node.css({'top':`${nodetop}px`, 'transition':'top 1s'});
			setTimeout(()=>{
				nodetop = childHeight;
				node.css({'top':`${nodetop}px`, 'transition':'top 0s'});
			}, 1000);
			tag = 2;
		} 

		if (tag == 2 && Math.abs(copytop) >= height*2-childHeight) {
			copytop-=childHeight;
			copy.css({'top':`${copytop}px`, 'transition':'top 1s'});
			setTimeout(()=>{
				copytop = childHeight-height;
				copy.css({'top':`${copytop}px`, 'transition':'top 0s'});
			}, 1000);
			tag = 1;
		}
		
		if (tag == 1) {
			nodetop-=childHeight;
			node.css({'top':`${nodetop}px`, 'transition':'top 1s'});
		} else {
			copytop-=childHeight;
			copy.css({'top':`${copytop}px`, 'transition':'top 1s'});
		}
		
	}, time);
}